package com.dayu.finecomm.handler.logger;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

import com.dayu.finecomm.protocol.ProtocolPacket;

public class PacketPackerHandler extends ChannelInboundHandlerAdapter {

	@Override
	public void channelRead(ChannelHandlerContext ctx, Object msg)
			throws Exception {

		if (!(msg instanceof ByteBuf)) {
			ctx.fireChannelRead(msg);
			return;
		}

		ctx.fireChannelRead(new ProtocolPacket(((ByteBuf) msg).slice(), false));
	}
}